package j03zuoye.pengzhuang;

public class Rectangle {
    Point startPoint;
    double width;
    double height;

    public Rectangle(Point startPoint, double width, double height) {
        this.startPoint = startPoint;
        this.width = width;
        this.height = height;
    }

    public boolean isIntersect(Rectangle rect) {
        //在右侧
        if(startPoint.x+width < rect.startPoint.x)return false;
        //在左侧
        if(rect.startPoint.x+rect.width< startPoint.x)return false;
        //在上面
        if(rect.startPoint.y- rect.height> startPoint.y)return false;
        //在下面
        if(startPoint.y-height>rect.startPoint.y)return false;
        return true;
    }
}
